class Solution
{
public:
    int minProcessingTime(vector<int> &processorTime, vector<int> &tasks)
    {
        sort(processorTime.begin(), processorTime.end());
        sort(tasks.begin(), tasks.end());
        int n = processorTime.size();
        int result = 0;
        int t = n * 4 - 1;
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < 4; j++)
            {
                result = max(result, tasks[t] + processorTime[i]);
                t--;
            }
        }
        return result;
    }
};